package com.wwc.sc.controller;

import com.wwc.sc.pojo.Dept;
import com.wwc.sc.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author WWC
 */
@RestController
public class DeptConsumerController {

    @Autowired
    private DeptClientService deptClientService;


    @RequestMapping("/consumer/dept/addDept")
    public int addDept(@RequestBody Dept dept){
        return this.deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/queryDept/{deptNo}")
    public Dept queryDept(@PathVariable("deptNo") String deptNo){
        return this.deptClientService.queryDept(deptNo);
    }

    @RequestMapping("/consumer/dept/queryAllDept")
    public List<Dept> queryAllDept(){
        return this.deptClientService.queryAllDept();
    }
}
